import Vue from 'vue'
import VueRouter from 'vue-router'


Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home'
    // meta: {
    //   title: 'AAAA',
    //   requireAuth: true
    // },
  },
  {
    name: 'home',
    path: '/home',
    component: () => import('@/views/Home.vue'),
    meta: {
      title: 'BBB',
      requireAuth: false
    },
  },
  {
    name: 'register',
    path: '/register',
    component: () => import('@/views/Register.vue'),
    meta: {
      title: '注册',
      requireAuth: true
    },
  },

  {
    name: 'bindcard',
    path: '/bindcard',
    component: () => import('@/views/BindCard.vue'),
    meta: {
      title: 'BBB',
      requireAuth: true
    },

  },
  {
    name: 'verifyprocess',
    path: '/verifyprocess',
    component: () => import('@/views/VerifyProcess.vue'),
    meta: {
      title: 'BBB',
      requireAuth: true
    },
  },
  {
    name: 'mycard',
    path: '/mycard',
    component: () => import('@/views/MyCard.vue'),
    meta: {
      title: 'CCC',
      requireAuth: true
    },

  },
  {
    name: 'qrcode',
    path: '/qrcode',
    component: () => import('@/views/QRcode.vue'),
    meta: {
      title: 'DDD',
      requireAuth: true
    },

  }
]

const router = new VueRouter({
  // mode: 'history', 导致打包后无法运行
  base: process.env.VUE_APP_BASE_API,
  routes
})

export default router
